package Interfaz;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.*;

public class Principal extends JFrame implements ActionListener
{
    private JButton BtEntrar;
    private JTextField JTCoreo;
    private JLabel LblCoreo;

    public Principal() 
    {
        initComponents();
        this.setLocationRelativeTo(null);
        this.setTitle("CORREO NUR");
        this.setSize(500,300);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setLayout(null);
        this.setVisible(true);
    }

    private void initComponents() {
        JTCoreo = new JTextField();
        LblCoreo = new JLabel();
        BtEntrar = new JButton();
        LblCoreo.setText("Correo Electronico");
        BtEntrar.setText("Entrar");
        LblCoreo.setBounds(50, 50, 120, 35);
        JTCoreo.setBounds(50, 100, 220, 35);
        BtEntrar.setBounds(300, 100, 70, 35);
        
        this.add(LblCoreo);
        this.add(JTCoreo);
        this.add(BtEntrar);
        
        BtEntrar.addActionListener(this);
    }
    public JButton getBtEntrar() {
        return BtEntrar;
    }

    public JTextField getJTCoreo() 
    {
        return JTCoreo;
    }

    public JLabel getLblCoreo() {
        return LblCoreo;
    }
    public static void main(String args[]) 
    {
        new Principal();
    }

    @Override
    public void actionPerformed(ActionEvent e) {
    	String coreo ="ajhuacho64@hotmail.com";
        if(e.getSource()== BtEntrar){
	        if(JTCoreo.getText().equals(coreo))
	        {    
	            Menu me = new Menu();
	            me.setVisible(true);
	            dispose();
	        }
	        else{
	            JOptionPane.showMessageDialog(this, "Error en el coreo ");
	        }       
        }
    }
}

